CREATE TABLE [dbo].[ResultWork]
(
[Ik_ResultWork] [uniqueidentifier] NOT NULL ROWGUIDCOL,
[idUspevDocs] [int] NOT NULL,
[SystemNumber] [int] NOT NULL,
[Ik_ListReq] [int] NOT NULL,
[LoadDoc] [varbinary] (max) FILESTREAM NOT NULL,
[DATELOAD] [date] NOT NULL
CONSTRAINT [ResultWorkPrimary] PRIMARY KEY CLUSTERED  ([Ik_ResultWork]) ON [PRIMARY]
) ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1]
GO
ALTER TABLE [dbo].[ResultWork] ADD CONSTRAINT [ResultWorkSystemNumberUnique] UNIQUE NONCLUSTERED  ([Ik_ListReq])
GO
ALTER TABLE [dbo].[ResultWork] ADD CONSTRAINT [ResultWorkUspevKPThemeForeign] FOREIGN KEY ([idUspevDocs]) REFERENCES [dbo].[UspevKPTheme] ([idUspevDocs]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ResultWork] ADD CONSTRAINT [ResultWorkListReqForeign] FOREIGN KEY ([Ik_ListReq]) REFERENCES [dbo].[ListReq] ([Ik_ListReq])
GO
